package com.evol.enums;

public enum HandlerMessage {
    UTEMPTY("用户或token令牌不能为空", "user or meta token can not be empty"),
    UDISENABLE("用户[%s]被禁用", "user [%s] is disabled"),
    UINVALID("用户[%s]的token失效", "invalid meta token for user [%s]"),
    UPRFE("用户[%s]端口范围[%s]格式错误", "user [%s] port range [%s] format error"),
    UPRFEN("用户[%s]端口范围[%s]起始或结束端口不是数字", "user [%s] port range [%s] start or end port is not a number"),
    UAPNN("用户[%s]允许的端口[%s]不是数字", "user [%s] allowed port [%s] is not a number"),
    UPNA("不允许用户[%s]端口[%s]", "user [%s] port [%s] is not allowed"),
    UDNA("不允许用户[%s]域名[%s]", "user [%s] domain [%s] is not allowed"),
    USDNA("不允许用户[%s]子域名[%s]", "user [%s] subdomain [%s] is not allowed"),
    UNEXIST("用户名[%s]不存在", "user [%s] not exist");

    private String zhMessage;
    private String enMessage;

    HandlerMessage(String zhMessage, String enMessage) {
        this.zhMessage = zhMessage;
        this.enMessage = enMessage;
    }
    public String getMessage(String language) {
        switch (language) {
            case "zh":
                return zhMessage;
            case "en":
                return enMessage;
            default:
                throw new IllegalArgumentException("Unsupported language: " + language);
        }
    }
}
